package com.maddox.maddoxppjoke.util;

import android.util.DisplayMetrics;

import com.maddox.libcommon.utils.AppGlobals;

/**
 * 屏幕尺寸工具类
 */
public class PixUtils {

    public static int dp2px(int dpValue) {
        DisplayMetrics displayMetrics = AppGlobals.getApplication().getResources().getDisplayMetrics();
        float density = displayMetrics.density;
        return (int) (dpValue * density + 0.5f);
    }

    public static int getScreenWith() {
        DisplayMetrics displayMetrics = AppGlobals.getApplication().getResources().getDisplayMetrics();
        return displayMetrics.widthPixels;
    }

    public static int getScreenHeight() {
        DisplayMetrics displayMetrics = AppGlobals.getApplication().getResources().getDisplayMetrics();
        return displayMetrics.heightPixels;
    }

}
